import request from '@/utils/request'

// 修改物料信息状态
export function updStatusAll(ids, status) {
  return request({
    url: '/materialPurchase/material-purchase/updStatus',
    method: 'post',
    params: {
      ids: ids,
      preStatus: status
    }
  })
}

//  初始化表格：根据 部门名称 查询所有状态为 审批中 的采购表
export function initTable(departName, currentPage, pageSize) {
  return request({
    url: '/materialPurchase/material-purchase/selAllMaterial',
    method: 'post',
    params: {
      preStatus: '审批中',
      departName: departName,
      currentPage: currentPage,
      pageSize: pageSize
    }
  })
}

//  插入新的物料采购计划
export function insertPurchase(materialName, purchaseNum, partUsed, remark, departName) {
  return request({
    url: '/materialPurchase/purchase-information/insOne',
    method: 'post',
    params: {
      materialName: materialName,
      purchaseNum: purchaseNum,
      partUsed: partUsed,
      remark: remark,
      departName: departName, // 待修改
      preStatus: '审批中'
    }
  })
}

